package com.util;

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.Properties;

public class PropertiesUtil {
	private Properties prop=null;
	
	public PropertiesUtil() {
		try {
			prop = new Properties();
			InputStream in = getClass().getResourceAsStream("../../cn.properties");
			prop.load(in);
//			System.out.println(new String(prop.getProperty("124")));
		} catch (IOException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			this.prop = null;
		}	
	}
	
	public String getCardName(String cardid){
		if (this.prop==null) {
			return "";
		}
		String res="";
		try {
//			System.out.println(cardid);
			res=new String(prop.getProperty(cardid));
			String[] ress=res.split(",");
			res=ress[0];
		} catch (Exception e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			return "";
		}
		return res;
	}
	public String getCardStarLv(String cardid){
		if (this.prop==null) {
			return "";
		}
		String res="";
		try {
//			System.out.println(cardid);
			res=new String(this.prop.getProperty(cardid));
			String[] ress=res.split(",");
			res=new String(ress[1]);
		} catch (Exception e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			return "0";
		}
		return res;
	}
}
